import { http } from '@/utils/http'
import type { BannerItem, GuessItem } from '@/types/home'
import type { CategoryItem } from '@/types/CategoryItem'
import type { HotItem } from '@/types/hotItem'
import type { PageParams, PageResult } from '@/types/global'


/**
 * 获取首页轮播图数据
 * @param distributionSite 活动 banner 位置，1 代表首页，2 代表商品分类页，默认为 1
 */
export const getHomeBannerAPI = (distributionSite = 1) => {
  return http<BannerItem[]>({
    method:'GET',
    url:'/home/banner',
    data:'distributionSite'
  })
}


/**
 * 首页分类
 * /home/category/mutli
 */
export const getCategoryAPI = () => {
  return http<CategoryItem[]>({
    method:'GET',
    url:'/home/category/mutli'
  })
}

/**
 * 热门推荐
 */
export const getHomeHotAPI = () => {
  return http<HotItem[]>({
    method: 'GET',
    url: '/home/hot/mutli',
  })
}

/**
 * 猜你喜欢api
 * /home//guessLike
 * ? - 表示可选，可不选 ， ！ - 非空断言
 */
export const getHomeGoodsGuessLikeAPI = (data? : PageParams) => {
  return http<PageResult<GuessItem>>({
    method:'GET',
    url:'/home/goods/guessLike',
    data,
  })
}
